<div class="box-body">
    <form class="layui-form" action="{:url('/cha/carrier/save')}" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">承运商	</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="承运商"  name="carrier_name" {if isset($carrier)}value="{$carrier.carrier_name}"{/if}  class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">编号</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="承运商编号"  name="carrier_num" {if isset($carrier)}value="{$carrier.carrier_num}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">付款方式</label>
            <div class="layui-input-block">
                <select name="pay_type">
                    <option value="">请选择</option>
                    {foreach $pay_type as $k=>$t}
                    <option {if isset($carrier) && $t==$carrier.pay_type}selected{/if} value="{$k}">{$t}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input type="number" autocomplete="off" placeholder="排序"  name="sort" {if isset($carrier)}value="{$carrier.sort}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">系统网址</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="承运商系统网址"  name="site" {if isset($carrier)}value="{$carrier.site}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">登录账号</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="承运商系统账号"  name="username" {if isset($carrier)}value="{$carrier.username}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">登录密码</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="承运商系统密码"  name="password" {if isset($carrier)}value="{$carrier.password}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">对接文档链接</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="对接文件链接"  name="document_path" {if isset($carrier)}value="{$carrier.document_path}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提货时间</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="提货时间"  name="take_time" {if isset($carrier)}value="{$carrier.take_time}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">出库时间</label>
            <div class="layui-input-block">
                <input  class="layui-input" type="text" autocomplete="off" placeholder="出库时间"  name="out_time" {if isset($carrier)}value="{$carrier.out_time}"{/if}/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">承运商地址</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="承运商地址"  name="address" {if isset($carrier)}value="{$carrier.address}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">对接类</label>
            <div class="layui-input-block">
                <select name="classes">
                    <option value="">请选择</option>
                    {foreach $service as $s}
                    <option {if isset($carrier) && $s==$carrier.classes}selected{/if} value="{$s}">{$s}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        {if isset($carrier) && !empty($carrier.classes)}
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">api请求路径</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="例如：http://wwww.lmterp.cn"  name="api_base_url" {if isset($carrier)}value="{$carrier.api_base_url}"{/if} class="layui-input" />
            </div>
        </div>
        {/if}
        {if isset($tokenField)}
        {foreach $tokenField['required'] as $r}
        {php}$field=$r['field'];{/php}
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">{$r.name}</label>
            <div class="layui-input-block">
                {if $r.type == 'select'}
                <select name="token_{$r.field}">
                    <option value="">请选择</option>
                    {foreach $r['value'] as $k=>$v}
                    <option {if isset($carrier->token->$field) && $carrier->token->$field == $k}selected{/if} value="{$k}">{$v}</option>
                    {/foreach}
                </select>
                {else}
                <input type="text" {if isset($r['readonly']) && $r['readonly']}readonly style="border: 0px;"{/if} name="token_{$r.field}" {if isset($carrier->token->$field)}value="{$carrier->token->$field}"{/if} placeholder="密钥可为空，若填一项带星号的都必填" class="layui-input">
                {/if}
            </div>
        </div>
        {/foreach}
        {foreach $tokenField['option'] as $r}
        {php}$field=$r['field'];{/php}
        <div class="layui-form-item">
            <label class="layui-form-label">{$r.name}</label>
            <div class="layui-input-block">
                {if $r.type == 'select'}
                <select name="token_{$r.field}">
                    <option value="">请选择</option>
                    {foreach $r['value'] as $k=>$v}
                    <option {if isset($carrier->token->$field) && $carrier->token->$field == $k}selected{/if} value="{$k}">{$v}</option>
                    {/foreach}
                </select>
                {else}
                <input type="text" {if isset($r['readonly']) && $r['readonly']}readonly style="border: 0px;"{/if} name="token_{$r.field}" {if isset($carrier->token->$field)}value="{$carrier->token->$field}"{/if} placeholder="可不填" class="layui-input">
                {/if}
            </div>
        </div>
        {/foreach}
        {/if}
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="备注"  name="remark" {if isset($carrier)}value="{$carrier.remark}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" value="1" {if !isset($carrier) || (isset($carrier) && $carrier.status)}checked{/if} lay-skin="switch">
            </div>
        </div>
        {if isset($carrier)}
        <input type="hidden" name="carrier_id" value="{$carrier.carrier_id}">
        {/if}
    </form>
</div>